package upgrade

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/sagoo-cloud/sagooiot/api/v1/common"
	"github.com/sagoo-cloud/sagooiot/internal/model"
)

// GetDevOtaStrategyListReq 获取数据列表
type GetDevOtaStrategyListReq struct {
	g.Meta `path:"/dev_ota_strategy/list" method:"get" summary:"获取批量升级列表" tags:"升级"`
	common.PaginationReq
	Name             string `json:"name" description:"升级批次名称"`
	DevOtaFirewareId int    `json:"devOtaFirewareId" description:"升级包id" v:"required#升级包id不能为空"`
}
type GetDevOtaStrategyListRes struct {
	Data []GetDevOtaStrategyByIdRes
	common.PaginationRes
}

// GetDevOtaStrategyByIdReq 获取指定ID的数据
type GetDevOtaStrategyByIdReq struct {
	g.Meta `path:"/dev_ota_strategy/get" method:"get" summary:"获取批量升级" tags:"升级"`
	Id     int `json:"id"        description:"id" v:"required#id不能为空"`
}
type GetDevOtaStrategyByIdRes struct {
	CreatedAt        string `json:"createdAt"          description:""`
	UpdatedAt        string `json:"updatedAt"          description:""`
	Id               string `json:"id"          description:""`
	WaitVersion      string `json:"waitVersion"          description:"待升级版本号"`
	Stratege         string `json:"stratege"          description:"1静态升级，2动态升级"`
	Method           string `json:"method"          description:"升级方式1http,2https,3mqtt"`
	Name             string `json:"name"  dc:"批次名称"`
	Push             int    `json:"push"             description:"主动推送:1是，2否"`
	DevOtaFirewareId int    `json:"devOtaFirewareId" description:"升级包id"`
	Status           int    `json:"status"           description:"1升级中，2完成"`
	Active           int    `json:"active"           description:"是否激活0否，1是"`
	Typo             int    `json:"typo"             description:"1验证,2升级"`
}

// AddDevOtaStrategyReq 添加数据
type AddDevOtaStrategyReq struct {
	g.Meta `path:"/dev_ota_strategy/add" method:"post" summary:"添加批量升级" tags:"升级"`
	model.DevOtaStrategyAddInput
}
type AddDevOtaStrategyRes struct{}

// EditDevOtaStrategyReq 编辑数据api
type EditDevOtaStrategyReq struct {
	g.Meta `path:"/dev_ota_strategy/edit" method:"put" summary:"编辑批量升级" tags:"升级"`
	model.DevOtaStrategyEditInput
}
type EditDevOtaStrategyRes struct{}

// EditDevOtaStrategyReq 编辑数据api
type StopDevOtaStrategyReq struct {
	g.Meta `path:"/dev_ota_strategy/stop" method:"put" summary:"停止/启用升级批次" tags:"升级"`
	Id     int `json:"id" description:"批次id" v:"required#id不能为空"`
	Active int `json:"active" description:"是否激活0否，1是" v:"required#active不能为空"`
}
type StopDevOtaStrategyRes struct{}

// DeleteDevOtaStrategyReq 删除数据
type DeleteDevOtaStrategyReq struct {
	g.Meta `path:"/dev_ota_strategy/delete" method:"delete" summary:"删除批量升级" tags:"升级"`
	Ids    []int `json:"ids"        description:"ids" v:"required#ids不能为空"`
}
type DeleteDevOtaStrategyRes struct{}
